Skip to content

Fix game mode crash: null-guard node in HandleEditEvent#23

Merged
willwade merged 1 commit into
mainfrom
fix/game-module-null-node-crash
Jun 19, 2026
Merged

Fix game mode crash: null-guard node in HandleEditEvent#23
willwade merged 1 commit into
mainfrom
fix/game-module-null-node-crash

Conversation

@willwade

Copy link
Copy Markdown

Problem

DasherApp build 32 on TestFlight hit a crash (1 of 4 total) when entering game mode:

EXC_BAD_ACCESS (SIGSEGV) at 0x0000000000000054

Thread 0 Crashed:
0   CGameModule::HandleEditEvent(type, strText, node) + 36
1   CScreenGameModule::HandleEditEvent(type, strText, node) + 28
2   std::function<...>::operator()(...)
3   CDasherInterfaceBase::editOutput(strText, node)
4   CSymbolNode::Do()

User comment: "Started game mode". Crash fires when the first character is typed after entering game mode.

Root cause

TextOutputAction::execute (ControlManager.cpp:212) passes nullptr as the cause node:

void TextOutputAction::execute(CDasherInterfaceBase* intf) {
    intf->editOutput(m_text, nullptr);   // ← nullptr as pCause
}

This nullptr propagates through OnEditEvent.BroadcastCGameModule::HandleEditEvent. The game module then dereferences node->offset() unconditionally, crashing at address 0x54 (the offset of m_Offset within CDasherNode when this is null):

void CGameModule::HandleEditEvent(..., CDasherNode* node) {
    if (!m_pAlph) return;
    const int iOffset(node->offset());  // ← node is nullptr → SIGSEGV at 0x54

This is the normal character-typing path: CSymbolNode::Do()TextOutputAction::executeeditOutput(text, nullptr). Every regular character triggers it; the crash only manifests in game mode because HandleEditEvent is the subscriber that actually dereferences node.

Fix

Add a null guard at the top of HandleEditEvent:

if (!node) return;

A null-node edit event carries no useful information for game-mode tracking (which needs the node offset to verify the user typed the correct target character). Dropping it is safe.

1 insertion, 0 deletions. No API changes.

Verification

  • clang-format: clean
  • Register dump from the crash confirms x3 (the node parameter) was 0x0000000000000000

Related

The TextOutputAction::execute passing nullptr is by design — actions don't have access to the triggering node. An alternative fix would be threading the node through the action system, but that's a much larger change for no user-visible benefit. The null guard in HandleEditEvent is the right level.

TextOutputAction::execute passes nullptr as the cause node to
editOutput (ControlManager.cpp:212). This propagates through the
OnEditEvent subscription to CGameModule::HandleEditEvent, which
unconditionally dereferences node->offset() and crashes with
EXC_BAD_ACCESS at address 0x54 (the offset of m_Offset within
CDasherNode).

This caused the 4th TestFlight crash on DasherApp build 32
(iPhone 14,2 / iOS 26.5) — user comment: 'Started game mode'.
The crash fires when the first character is typed after entering
game mode.

Fix: return early if node is null. A null-node edit event carries
no useful information for game-mode tracking (which needs the node
offset to check whether the user typed the correct target character
at the right position).

Signed-off-by: will wade <willwade@gmail.com>
@willwade willwade merged commit 581093e into main Jun 19, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant